package com.lex.crossgate.admin.common.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * 释放静态资源
 *
 * @ProjectName: crossgate
 * @Package: com.lex.crossgate.admin.common.support.config
 * @ClassName: ${TYPE_NAME}
 * @Description: 释放静态资源
 * @Author: 李贝留斯
 * @CreateDate: 2018/5/4 16:45
 * @Version: 1.0
 **/
@Configuration
public class WebConfig extends WebMvcConfigurerAdapter {

    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
    }

    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**");
    }
}
